/*
** my_getnbr.c for my_getnbr in /home/nadali_t//afs/rendu/lib/my
** 
** Made by thomas nadalie
** Login   <nadali_t@epitech.net>
** 
** Started on  Tue Oct 23 19:58:18 2012 thomas nadalie
** Last update Tue Oct 23 20:04:05 2012 thomas nadalie
*/

int     my_getnbr(char *str)
{
  int   pos;
  int   signe;
  int   nbr;

  signe = 1;
  pos = 0;
  while (((str[pos] != '\0') && (str[pos] == '+')) || (str[pos] == '-'))
    {
      if (str[pos] == '-')
        {
          signe = signe * -1;
        }
      pos = pos + 1;
    }
  str = str + pos;
  nbr = 0;
  pos = 0;
  while ((str[pos] >= '0') && (str[pos] <= '9'))
    {
      nbr = nbr * 10;
      nbr = nbr - (str[pos] - '0');
      pos = pos + 1;
    }
  return (nbr * signe * -1);
}
